package com.bioroadlab.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.bioroadlab.pojo.Disease;
import com.bioroadlab.pojo.TestObject;

@Repository
public class TestObjectDao extends BaseDao<TestObject, Integer> {
	public List<TestObject> findTestObjectByDisease(Disease disease) {

		String hql = "from TestObject a inner join fetch a.diseases b where a.diseases=:disease";
		Query query = getSession().createQuery(hql);
		query.setParameter("disease", ("a." + disease));
		query.list();
		@SuppressWarnings("unchecked")
		List<TestObject> testObject = ((List<TestObject>) query.list());
		return testObject;
	}

}
